﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe
{
    public partial class EQ_List : Form
    {
        DataSet DeptList;

        DataSet EQList;
        public EQ_List()
        {
            InitializeComponent();
           
            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.HSP_Department_List(DataTemp.HSPID);

            comboBox1.DataSource = DeptList.Tables[0];
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember = "DeptNumber";

           

        }

      

        private void comboBox1_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            EQList = sop.Serv_EQ_List_By_Department(comboBox1.SelectedValue.ToString());

            DataGridView1.DataSource = EQList.Tables[0];
        }

        private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            EQList = sop.Serv_EQ_List_By_Department(comboBox1.SelectedValue.ToString());

            DataGridView1.DataSource = EQList.Tables[0];
        
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            string result = sop.Serv_DEL_EQ_By_Flag(EQList.Tables[0].Rows[DataGridView1.CurrentCell.RowIndex][1].ToString());

            MedEQ.Service1 sop4 = new MedEQ.Service1();
            EQList = sop4.Serv_EQ_List_By_Department(comboBox1.SelectedValue.ToString());

            DataGridView1.DataSource = EQList.Tables[0];

           
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            EQ_Task_List ts = new EQ_Task_List(EQList.Tables[0].Rows[DataGridView1.CurrentCell.RowIndex][1].ToString());
            ts.Show();
        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            EQ_Task_List ts = new EQ_Task_List(EQList.Tables[0].Rows[DataGridView1.CurrentCell.RowIndex][1].ToString());
            ts.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Add_Task add = new Add_Task(EQList.Tables[0].Rows[DataGridView1.CurrentCell.RowIndex][0].ToString());
            add.ShowDialog();
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        

        private void DataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            EQ_Task_List ts = new EQ_Task_List(EQList.Tables[0].Rows[DataGridView1.CurrentCell.RowIndex][1].ToString());
            ts.Show();
        }

        private void skinButton1_Click(object sender, EventArgs e)
        {
           string DeptKey="0";
            if (comboBox1.Text.Length > 2)
                DeptKey = skinComboBox1.SelectedValue.ToString();







            MedEQ.Service1 sop = new MedEQ.Service1();
            EQList = sop.Serv_EQ_List_By_Department(DeptKey);

            DataGridView1.DataSource = EQList.Tables[0];
            DataGridView1.Columns[1].Width = 100;
           
             


          

        }

      

      

        private void label5_Click(object sender, EventArgs e)
        {

        }

      

        private void skinButton3_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();

            EQList = sop.Find_EQ_By_Sr(skinTextBox2.Text.ToString().Trim());

            DataGridView1.DataSource = EQList.Tables[0];
            DataGridView1.Columns[1].Width = 100;
        }

        private void skinButton4_Click(object sender, EventArgs e)
        {
           
        }

        private void EQ_List_Load(object sender, EventArgs e)
        {

        }

        private void skinButton4_Click_1(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();

            EQList = sop.Find_EQ_Find_List(skinTextBox3.Text.ToString().Trim());

            DataGridView1.DataSource = EQList.Tables[0];
            DataGridView1.Columns[1].Width = 100;
        }

        private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
        {



            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.HSP_Department_List(comboBox1.SelectedValue.ToString());

            skinComboBox1.DataSource = DeptList.Tables[0];
            skinComboBox1.DisplayMember = "Name";
            skinComboBox1.ValueMember = "DeptNumber";
        }
        }
        
    }

